import tool from '../scripts/tool';
import config from "./index"
export default (plugin,properties)=>{
  return  new Promise((resolve,reject)=>{
    tool.loadPlugin(
        tool.replaceURL(
            config.API_URL +
            "/static/plugins/" +
            plugin.javascriptFilename
        )
    ).then(
        resolve({default:window[plugin.id].default})
    ).catch(e=>{
        console.error(e)
        reject(e)
    })
  })   
}